<%--
  Created by IntelliJ IDEA.
  User: 兰宦君
  Date: 2015/10/12
  Time: 11:28
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<html>
<head>
  <meta charset="utf-8" />
  <title>BookStore——我的网上书店</title>
  <%@ include file="../layout/import.jsp"%>


  <script language="JavaScript">
    function orderBook(bookid) {
      $.ajax({
        url: "/orderbook.do",
        data: {id:bookid},
        method: "POST",
        dataType: "json",
        error: function () {
          alert("表单提交出错，请稍后再试");
        },
        success: function(response) {
          if(response.code == 0) {
            window.location.href = "/orderbook.do";
          }
          else {
            alert(response.description);
          }
        }
      });
    }
  </script>
</head>
<body>
<%@include file="nav.jsp"%>

<div class="container">

      <div class="row" id="bookshow" style="min-height: 75%">
        <c:forEach var="book" items="${bookList}">
          <div class="col-sm-12">
              <div class="col-sm-3">
                <h2>
                    ${book.bookname}
                </h2>
                  <p>
                      <a href="/bookDetail.do?id=${book.id}"><img style="width: 130px; height: 200px" src="${book.picture}"class="img-thumbnail"></a>
                  </p>
                  <p>
                      <a href="/bookDetail.do?id=${book.id}" class="btn btn-default" role="button">详细&raquo;</a>
                  </p>
              </div>
              <div class="col-sm-9" style="font-size: 16px;">
                  <br /><br /><br /><br />
                  <p>ISBN：${book.isbn}</p>
                  <p>作者：${book.author}</p>
                  <p>简介：</p>
                  <p>${book.content}</p>
                  <p>价格：</p>
                  <p>￥${book.price}</p>
              </div>
          </div>
        </c:forEach>

      </div><!--/row-->
    </div>
  </div>

    <nav>
      <ul class="pagination col-sm-12">

        <li <c:if test="${thisPage == 1}">class="disabled"</c:if> >
            <a <c:if test="${thisPage != 1}">href="/search.do?page=${thisPage - 1}&keyword=${keyword}"</c:if> aria-label="Previous">
                <span aria-hidden="true">&laquo;</span>
            </a>
        </li>

        <c:forEach var="page" begin="1" end="${totalPage}" step="1" >
          <li <c:if test="${thisPage eq page}">class="active"</c:if> ><a href="/search.do?page=${page}&keyword=${keyword}" > ${page}</a></li>
        </c:forEach>

        <li <c:if test="${thisPage eq totalPage}">class="disabled"</c:if>>
            <a <c:if test="${thisPage != totalPage}">href="/search.do?page=${thisPage + 1}&keyword=${keyword}"</c:if> aria-label="Next">
                <span aria-hidden="true">&raquo;</span>
            </a>
        </li>

      </ul>
    </nav>
</div>
<%@include file="footer.jsp"%>
</body>

</html>
